#ifndef _EXPORTERUTILITY_H_
#define _EXPORTERUTILITY_H_
#pragma once

#include <max.h>
#include <maxapi.h>
#include <utilapi.h>
#include <string>
#include <map>
#include <queue>
#include "exportobject.h"

using namespace std;

class CExportAnimData;
class ExporterUtility : public UtilityObj
{
public:
    // Construction
    ExporterUtility ();

    // Destruction
    ~ExporterUtility ();

    // From UtilityObj
    void BeginEditParams (Interface *ip, IUtil *iu);
    void EndEditParams (Interface *ip, IUtil *iu);
    void DeleteThis ();
    virtual void SelectionSetChanged(Interface *ip,IUtil *iu);

    static INT_PTR CALLBACK DlgProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

	void Export();
    void ExportSeparate();
    void Export( const string &fname );
    void UpdObjectPanel( INode *SelNode );

    HWND hRollup, hAnimList;
    string m_szProjectPath, m_szMeshPath, m_szAnimPath, m_szMaxModelPath, m_szMaxTexPath;

    CExportAnimData* AnimData; // Animation if loaded, default is an empty anim data
	static map<string,ExportMaterial*> SceneMaterials;

private:
	void WriteMaterials(ostream &stream);
	void GetAllChildren(INode *n, queue<INode*> &q);
	void ExporterUtility::BeginXml( ostream &os );
	void ExporterUtility::EndXml( ostream &os );
};

#endif
